#include <sys_head.h>

int main(int argc, char const *argv[])
{
    // 打开文件
    int fd = open("hqyj.txt" , O_CREAT | O_TRUNC | O_RDWR , 0666);
    if (-1 == fd)
    {
        ERRLOG("open");
    }
    
    // 文件的写入
    char buf[1024] = "-rw-rw-r-- 1 ubuntu ubuntu   674 Oct 14 09:51 01_test.c";
    write( fd , buf , strlen(buf));

    memset(buf , 0 , sizeof(buf));
    
    lseek( fd , 0 , SEEK_SET );


    // // 文件读取
    read( fd , buf , sizeof(buf));

    printf("文件读取: %s\n" , buf );

    close(fd);
    return 0;
}



